Skip to content

refactor(queue): consolidate bounded-concurrency helpers onto mapWithConcurrency#6721

Closed
pro3958 wants to merge 1 commit into
JSONbored:mainfrom
pro3958:fix/issue-6602
Closed

refactor(queue): consolidate bounded-concurrency helpers onto mapWithConcurrency#6721
pro3958 wants to merge 1 commit into
JSONbored:mainfrom
pro3958:fix/issue-6602

Conversation

@pro3958

@pro3958 pro3958 commented Jul 17, 2026

Copy link
Copy Markdown

What

src/queue/map-with-concurrency.ts is the canonical bounded-concurrency worker-pool helper, already reused across src/queue. Two files re-implemented the identical loop instead of importing it:

  • src/signals/focus-manifest-loader.tsmapWithConcurrencyLimit
  • src/queue/patchless-secret-scan.tsmapPatchLessSecretScanFilesWithConcurrency

Both now delegate to mapWithConcurrency, keeping their exported names and (items, limit, mapper) signatures unchanged, so every call site (including the two in src/queue/processors.ts) compiles and behaves exactly as before.

Why

Three copies of the same fan-out loop can silently drift. After this change map-with-concurrency.ts is the single implementation under src/queue/ and src/signals/; the other two just call into it.

Scope

Pure internal consolidation — no change to public behavior, call signatures, or export names. The two delegating wrappers are already exercised transitively by their callers' existing suites (test/unit/patchless-secret-scan.test.ts, the focus-manifest-loader / processors tests that drive mapWithConcurrencyLimit), so no new test is added.

Fixes #6602

…Concurrency

focus-manifest-loader's mapWithConcurrencyLimit and patchless-secret-scan's
mapPatchLessSecretScanFilesWithConcurrency each re-implemented the same
worker-pool loop that src/queue/map-with-concurrency.ts already exports. Both
now delegate to the canonical mapWithConcurrency, keeping their exported names
and (items, limit, mapper) signatures so every existing call site compiles and
behaves unchanged. No public behavior change; the two hand-duplicated loops
that could silently drift are gone.

Fixes JSONbored#6602
@pro3958
pro3958 requested a review from JSONbored as a code owner July 17, 2026 02:40
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

❌ 18 Tests Failed:

Tests completed Failed Passed Skipped
2835 18 2817 0
View the full list of 18 ❄️ flaky test(s)
test/integration/api.test.ts > test/integration/api.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/integration/orb-webhook.test.ts > test/integration/orb-webhook.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/auth-github-token.test.ts > test/unit/auth-github-token.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/cloudflare-worker-runtime-detection.test.ts > test/unit/cloudflare-worker-runtime-detection.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/index.test.ts > test/unit/index.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
test/unit/mcp-automation-state.test.ts > test/unit/mcp-automation-state.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-config-recommendation.test.ts > test/unit/mcp-config-recommendation.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 5 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-explain-gate-disposition.test.ts > test/unit/mcp-explain-gate-disposition.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-finding-taxonomy.test.ts > test/unit/mcp-finding-taxonomy.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-intake-idea.test.ts > test/unit/mcp-intake-idea.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-pr-reviewability.test.ts > test/unit/mcp-pr-reviewability.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-refresh-repo-docs.test.ts > test/unit/mcp-refresh-repo-docs.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/mcp-write-tools.test.ts > test/unit/mcp-write-tools.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/ops-wire.test.ts > test/unit/ops-wire.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-agent-approval.test.ts > test/unit/routes-agent-approval.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-gate-outcome-breakdown.test.ts > test/unit/routes-gate-outcome-breakdown.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-issue-rag.test.ts > test/unit/routes-issue-rag.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 3 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15
test/unit/routes-self-dogfood-registration-pack.test.ts > test/unit/routes-self-dogfood-registration-pack.test.ts

Flake rate in main: 100.00% (Passed 0 times, Failed 8 times)

Stack Traces | 0s run time
Error: Transform failed with 2 errors:

[PARSE_ERROR] Identifier `buildFindingTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:10:10 ]
     │
  10 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── `buildFindingTaxonomyDocument` has already been declared here
     │ 
 197 │ import { buildFindingTaxonomyDocument } from "../review/finding-taxonomy";
     │          ──────────────┬─────────────  
     │                        ╰─────────────── It can not be redeclared here
─────╯

[PARSE_ERROR] Identifier `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared
     ╭─[ src/api/routes.ts:11:10 ]
     │
  11 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── `buildEnrichmentAnalyzersTaxonomyDocument` has already been declared here
     │ 
 198 │ import { buildEnrichmentAnalyzersTaxonomyDocument } from "../review/enrichment-analyzers-taxonomy";
     │          ────────────────────┬───────────────────  
     │                              ╰───────────────────── It can not be redeclared here
─────╯

  Plugin: vite:oxc
  File: .../src/api/routes.ts
 ❯ transformWithOxc .../node/chunks/node.js:4017:19
 ❯ TransformPluginContext.transform .../node/chunks/node.js:4088:26
 ❯ EnvironmentPluginContainer.transform .../node/chunks/node.js:30151:51
 ❯ loadAndTransform .../node/chunks/node.js:20098:26
 ❯ fetchModule .../node/chunks/node.js:33534:15

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 17, 2026
@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-17 02:48:19 UTC

2 files · 1 AI reviewer · no blockers · CI failing · blocked

🛑 Suggested Action - Fix Blockers

Review summary
This PR consolidates two duplicate bounded-concurrency worker-pool implementations (in patchless-secret-scan.ts and focus-manifest-loader.ts) to delegate to the canonical mapWithConcurrency helper, preserving exported names and (items, limit, mapper) signatures so all call sites remain source-compatible. The refactor is mechanical and correct: both replaced loops are byte-for-byte equivalent in behavior to the original inline implementations (results array pre-sized, worker count capped at min(limit, items.length), same index-claiming loop), so this should be a true no-behavior-change consolidation. No new tests are added, but the PR description correctly notes existing suites for both wrapper functions already exercise this path transitively, and since the change is a pure delegation to an already-tested helper, that's reasonable.

Nits — 5 non-blocking
  • Neither src/queue/patchless-secret-scan.ts nor src/signals/focus-manifest-loader.ts show any test-path changes in this PR — worth confirming the existing suites actually exercise mapWithConcurrencyLimit and mapPatchLessSecretScanFilesWithConcurrency with limit < items.length to catch a future regression in the delegation, not just limit >= items.length.
  • The CI failures listed (validate, validate-tests x6, validate-code) are concerning for a 'pure refactor' PR — worth checking whether they're pre-existing/unrelated or caused by this change before merging, though CI outcome itself isn't a code defect to flag here.
  • Since mapWithConcurrency is now the single source of truth, consider adding a brief comment or test note in map-with-concurrency.ts flagging that focus-manifest-loader.ts and patchless-secret-scan.ts both delegate to it, so future changes to the core loop don't overlook these two call sites.
  • If not already covered, verify test/unit/patchless-secret-scan.test.ts and the focus-manifest-loader tests use a concurrency limit smaller than the item count, since that's the only branch where the old vs. new implementation could plausibly diverge.
  • Code changes lack test evidence — Add focused regression tests or explain why existing coverage is sufficient.

CI checks failing

  • validate
  • validate-tests (2)
  • validate-tests (4)
  • validate-tests (5)
  • validate-tests (1)
  • validate-tests (3)
  • validate-tests (6)
  • validate-code

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #6602
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ❌ 8/20 High review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 5 registered-repo PR(s), 0 merged, 0 issue(s).
Contributor context ✅ Confirmed Gittensor contributor pro3958; Gittensor profile; 5 PR(s), 0 issue(s).
Improvement ℹ️ None detected risk: low · value: none · LLM: minor
Linked issue satisfaction

Addressed
Both hand-duplicated loops (mapWithConcurrencyLimit in focus-manifest-loader.ts and mapPatchLessSecretScanFilesWithConcurrency in patchless-secret-scan.ts) are replaced with thin delegations to the canonical mapWithConcurrency, preserving exported names and (items, limit, mapper) signatures as required.

Review context
  • Author: pro3958
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: not available
  • Official Gittensor activity: 5 PR(s), 0 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Add a concise scope and risk note.
  • Then work through the remaining 1 step in the Signals table above.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed


💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →.

Checked by LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb

loopover-orb Bot commented Jul 17, 2026

Copy link
Copy Markdown

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests (2), validate-tests (4), validate-tests (5), validate-tests (1), validate-tests (3), validate-tests (6), validate-code)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate duplicate bounded-concurrency map helpers in src/queue and src/signals

1 participant